package joymouse.logger;

import java.io.PrintStream;

/**
 * A {@link Loggable} that when logged, prints its message. The only difference
 * between it and {@link Logger.Info} is its log level.
 *
 * @author Ben Wolsieffer
 */
public class Warning implements Loggable {

    /**
     * Warning logged when a command line argument is included twice.
     */
    public static final Warning ARGUMENT_INCLUDED_TWICE = new Warning("Argument included twice");

    /**
     * Prints the text {@code "Warning: "}, followed by the message to the
     * specified {@link PrintStream}.
     *
     * @param stream the stream to print to
     */
    @Override
    public void log(PrintStream stream) {
        stream.println("Warning: " + message);
    }
    private String message;

    /**
     * {@inheritDoc} {@code Warning}s are log level 1.
     */
    @Override
    public int getLevel() {
        return 1;
    }

    /**
     * Creates a new {@code Warning} with the specified message.
     *
     * @param message the warning message
     */
    public Warning(String message) {
        this.message = message;
    }
}
